#include "headfile.h"
/********************系统基础命令********************/
void cmd_wave(int argc){
  wave_flag(a2i(cmd_argv[1]));
  uprintf("%d Parametetr:\r\n",argc);
}
void cmd_flag(int argc){
  set_flag((uint8) a2i(cmd_argv[1]),(uint8) a2i(cmd_argv[2]));
  uprintf("%d Parametetr:\r\n",argc);
}
void cmd_float(int argc){
  set_flag((uint8) a2i(cmd_argv[1]),a2f(cmd_argv[2]));
  uprintf("%d Parametetr:\r\n",argc);
}
void cmd_int(int argc){
  set_flag((uint8) a2i(cmd_argv[1]),a2i(cmd_argv[2]));
  uprintf("%d Parametetr:\r\n",argc);
}
void cmd_beep(int argc){
  BEEP = a2i(cmd_argv[1]);
  uprintf("%d Parametetr:\r\n",argc);
}
/********************charge命令********************/
void cmd_charge(int argc){
  charge_parameter(a2f(cmd_argv[1]),a2f(cmd_argv[2]),a2f(cmd_argv[3]));
  uprintf("%d Parametetr:\r\n",argc);
  uprintf("P=%f I=%f Target=%f\r\n",a2f(cmd_argv[1]),a2f(cmd_argv[2]),a2f(cmd_argv[3]));
}
void cmd_charge_show(int argc){
  charge_show();
  uprintf("%d Parametetr:\r\n",argc);
}
/********************icm命令********************/
void cmd_icm_k(int argc){
  icm_set_k(a2f(cmd_argv[1]));
  uprintf("%d Parametetr:\r\n",argc);
}
/********************motor********************/
void cmd_motor(int argc){
  if(a2i(cmd_argv[1])) motor_enable();
  else motor_disable();
  uprintf("%d Parametetr:\r\n",argc);
}
void cmd_angle_pd(int argc){  
  motor_angle_pd(a2f(cmd_argv[1]),a2f(cmd_argv[2]));
  uprintf("%d Parametetr:\r\n",argc);
}
void cmd_speed_pi(int argc){
  motor_speed_pi(a2f(cmd_argv[1]),a2f(cmd_argv[2]));
  uprintf("%d Parametetr:\r\n",argc);
}
void cmd_target_angle(int argc){
  target_angle=a2f(cmd_argv[1]);
  uprintf("%d Parametetr:\r\n",argc);
}




